//
//  UITextView+Extension.h
//  TableDemo
//
//  Created by jutuo on 2020/4/3.
//  Copyright © 2020 jutuo. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <objc/runtime.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, UITextViewFormatterType) {
    
    // version：1.0
    UITextViewFormatterTypeAny = 0,             // 不过滤
    UITextViewFormatterTypeNumber,              // 数字
    UITextViewFormatterTypeAlphabet,            // 英文字母
    UITextViewFormatterTypeNumberAndAlphabet,   // 数字+英文字母
    UITextViewFormatterTypeDisableEmoji,        //过滤表情
    UITextViewFormatterTypeCustom               // 自定义
};

@interface UITextView (Extension)
// 格式类型
@property (nonatomic, assign) UITextViewFormatterType formatterType;

// 限制长度
@property (nonatomic, assign) NSUInteger limitLength;

// 允许的字符集
@property (nonatomic, copy)   NSString *characterSet;
/**
*在您设置好您需要的过滤方案后，请在textField的代理中，调用此方法，否则您的设置将不会有任何的作用
*/
- (void)textViewDidBeginEditing;
- (void)textViewDidChange;

/**
 Set all text selected.
 */
- (void)selectAllText;
/**
 * 获取选择范围
 */
- (NSRange)selectedRange;

/**
 Set text in range selected.
 
 @param range  The range of selected text in a document.
 */
- (void)setSelectedRange:(NSRange)range;
@end

@interface UITextView  (XYPlaceholder)
/**占位符*/
@property (nonatomic, copy) NSString *placeholder;
/**占位符颜色*/
@property (nonatomic, copy) UIColor *placeholderColor;

- (void)updatePlaceHolder;
@end

NS_ASSUME_NONNULL_END
